package com.qingke.stockdata.controller;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.qingke.stockdata.model.User;
import com.qingke.stockdata.service.UserService;

@Controller
public class LoginController {

	
	@Autowired
	UserService userService;
	
	@RequestMapping("/login")
	public String login(Model model) {
		
		
		return "login";
	}
	
	@RequestMapping("/successLogin")
	public String successLogin(@Param("username") String username ,@Param("password") String password){
		
		User user = userService.login(username, password);
		if(user!=null){
			
			return "index";
		}
		
		return "login";
	}
}
